<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function fun1(){
				var num1=document.getElementById("num1").value
				var num2=document.getElementById("num2").value
				if(isNaN(num1) || isNaN(num2)){
					alert("请输入数字")
					return
				}
				var res=(num1-0)+(num2-0)
				document.getElementById("num3").value=res.toFixed(16)-0
			}
			function fun2(){
				var num1=document.getElementById("num1").value
				var num2=document.getElementById("num2").value
				var res=num1-num2
				document.getElementById("num3").value=res
			}
			function fun3(){
				var num1=document.getElementById("num1").value
				var num2=document.getElementById("num2").value
				var res=num1*num2
				document.getElementById("num3").value=res
			}
			function fun4(){
				var num1=document.getElementById("num1").value
				var num2=document.getElementById("num2").value
				if(num2==0){
					alert("除数不能为0")
					return;
				}
				var res=num1/num2
				document.getElementById("num3").value=res
			}
		</script>
	</head>
	<body>
		第一个数： <input type="text" id="num1"/> <br>
		第二个数： <input type="text" id="num2"/> <br>
		<button onclick="fun1()">+</button>
		<button onclick="fun2()">-</button>
		<button onclick="fun3()">*</button>
		<button onclick="fun4()">/</button> <br>
		计算结果： <input type="text" id="num3"/> <br>
		
	</body>
</html>
